/*
 * Copyright (c) 2011, Marc-Andre Ferland - madrang@gmail.com
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the The Warrent Team nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *     * This software is free for non-commercial use. You may not use this
 *       software, in whole or in part, in support of any commercial product
 *       without the express consent of the author.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE WARRENT TEAM BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
using System;

namespace OsHelper.UsbNet
{
	/// <summary>
	/// The device request failed because the device was not found.
	/// </summary>
	public class DeviceNotFoundException : Exception
	{
		public DeviceNotFoundException()
			: base("The request failed because the device was not found.")
		{
		}
		
		public DeviceNotFoundException(string message) : base(message)
		{
		}
	}
        
	/// <summary>
	/// The descriptor contains errors.
	/// </summary>
	public class InvalidDescriptorException : Exception
	{
		public InvalidDescriptorException()
			: base("The descriptor contains errors.")
		{
		}
		
		public InvalidDescriptorException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// A synchronous device IO operation failed.
	/// </summary>
	public class IOSyncFailedException : Exception
	{
		public IOSyncFailedException()
			: base("The synchronous device IO operation failed.")
		{
		}
		
		public IOSyncFailedException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// A specified endpoint is invalid for the operation.
	/// </summary>
	public class InvalidEndpointException : Exception
	{
		public InvalidEndpointException()
			: base("The specified endpoint is invalid for the operation.")
		{
		}
		
		public InvalidEndpointException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// A request to cancel IO operation failed.
	/// </summary>
	public class CancelFailedException : Exception
	{
		public CancelFailedException()
			: base("Failed to cancel IO operation.")
		{
		}
		
		public CancelFailedException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// An operation was cancelled by the user before it completed.
	/// </summary>
	/// <remarks>
	/// Cancelled errors may occur as normal operation.
	/// </remarks>
	public class CancelledException : Exception
	{
		public CancelledException()
			: base("An operation was cancelled by the user before it completed.")
		{
		}
		
		public CancelledException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// An operation timed out before it completed.
	/// </summary>
	/// <remarks>
	/// TimedOut errors may occur as normal operation.
	/// </remarks>
	public class TimedOutException : Exception
	{
		public TimedOutException()
			: base("An operation timed out before it completed.")
		{
		}
		
		public TimedOutException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// An attempt was made to lock a device that is already locked.
	/// </summary>
	public class DeviceLockedException : Exception
	{
		public DeviceLockedException()
			: base("An attempt was made to lock a device that is already locked.")
		{
		}
		
		public DeviceLockedException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// An attempt was made to lock an endpoint that is already locked.
	/// </summary>
	public class EndpointLockedException : Exception
	{
		public EndpointLockedException()
			: base("An attempt was made to lock an endpoint that is already locked.")
		{
		}
		
		public EndpointLockedException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// Resource Busy.
	/// </summary>
	public class ResourceBusyException : Exception
	{
		public ResourceBusyException()
			: base("Resource Busy.")
		{
		}
		
		public ResourceBusyException(string message) : base(message)
		{
		}
	}
	
	/// <summary>
	/// Pipe error or endpoint halted.
	/// </summary>
	public class PipeErrorException : Exception
	{
		public PipeErrorException()
			: base("Pipe error or endpoint halted.")
		{
		}
		
		public PipeErrorException(string message) : base(message)
		{
		}
	}
		
	/// <summary>
	/// System call interrupted.
	/// </summary>
	public class InterruptedException : Exception
	{
		public InterruptedException()
			: base("System call interrupted.")
		{
		}
		
		public InterruptedException(string message) : base(message)
		{
		}
	}
}
